

<script>
import { useIndex } from "../stores/index.js";
import { computed } from "vue";
export default {
  setup() {
    const indexStore = useIndex();
    return {
      SideLeftMeShow: computed(() => indexStore.SideLeftMeShow),
    };
  },
};
</script>

<template>
  <div :class="['BottomNavigationBar', SideLeftMeShow ? 'show' : 'hide']">
    <router-link to="/BookCase" custom v-slot="{ navigate, href, isActive }">
      <div :href="href" @click="navigate" class="item">
        <em
          :class="['iconfont', 'icon-a-wenjianshuben']"
          :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
        ></em>
        <span class="title" :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
          >书架</span
        >
      </div>
    </router-link>

    <router-link to="/BookCity" custom v-slot="{ navigate, href, isActive }">
      <div :href="href" @click="navigate" class="item">
        <em
          :class="['iconfont', 'icon-faxian1']"
          :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
        ></em>
        <span class="title" :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
          >书城</span
        >
      </div>
    </router-link>

    <router-link to="/BookCabinet" custom v-slot="{ navigate, href, isActive }">
      <div :href="href" @click="navigate" class="item">
        <em
          :class="['iconfont', 'icon-wodepinglun']"
          :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
        ></em>
        <span class="title" :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
          >书阁</span
        >
      </div>
    </router-link>

    <router-link to="/BookStore" custom v-slot="{ navigate, href, isActive }">
      <div :href="href" @click="navigate" class="item">
        <em
          :class="['iconfont', 'icon-zuanshihuiyuan-line']"
          :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
        ></em>
        <span class="title" :style="{ color: isActive ? '#fe537a' : '#423d5b' }"
          >活动</span
        >
      </div>
    </router-link>
  </div>
</template>



<style lang="scss" scoped>
.BottomNavigationBar {
  height: 54px;
  position: fixed;
  left: 0;
  right: 0;
  margin: auto;
  min-width: 320px;
  max-width: 750px;
  bottom: 0;
  width: 100%;
  display: flex;
  align-items: center;
  box-shadow: 0 -1px 6px 1px rgba($color: #000000, $alpha: 0.1);
  transition: all 0.3s ease;
  z-index: 10;
  background-color: #fff;

  &.show {
    left: calc(100% - 80px);
  }

  &.hide {
    left: 0;
  }

  .item {
    flex: 1;
    display: flex;
    align-items: center;
    flex-direction: column;
    transition: all 0.3s ease;

    &:active {
      transform: scale(0.9);
      opacity: 0.7;
      text-shadow: 0 0 15px #fe537a;
    }

    &:nth-child(1) {
      .iconfont {
        font-size: 20px;
        font-weight: bold;
      }
    }

    &:nth-child(2) {
      .iconfont {
        font-weight: bold;
        font-size: 24px;
      }
    }

    &:nth-child(3) {
      .iconfont {
        font-weight: bold;
      }
    }

    &:nth-child(4) {
      .iconfont {
        font-weight: bold;
      }
    }

    .iconfont {
      display: block;
      font-size: 22px;
      height: 24px;
      display: flex;
      align-items: center;
      color: #423d5b;
    }
    .title {
      display: block;
      margin-top: 5px;
      color: #423d5b;
      font-size: 12px;
    }
  }
}
</style>